import uvicorn
import json
import time
from fastapi import FastAPI

app = FastAPI()


@app.get("/")
def index():
    return "Hello World!"


@app.post("/index/hook/on_record_mp4")
def on_record_mp4(body: dict):
    start_time = body["start_time"]
    print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(start_time)))
    print(json.dumps(body, indent=4))


if __name__ == '__main__':
    uvicorn.run(app, host="127.0.0.1", port=18000, debug=True)
